<?php
    require_once "../../config.php";
    require_once "../../functions.php";
    //获取前端传来的拥有id的数组
    $ids = $_POST["ids"];
    
    //连接数据库
    $connect = connect();
    
    //sql语句
    $allDelSql = "DELETE from categories where id in (".implode(",",$ids).")";
    // echo $allDelSql;
    //执行sql语句
    $result = mysqli_query($connect,$allDelSql);
    $response = ["code"=>0,"msg"=>"操作失败"];
    if($result){
        $response["code"] = 1;
        $response["msg"] = "操作成功";
    }
    header("content-type:application/json;charset=ut8");
    echo json_encode($response);
?>